Complete API reference for the three-tier application
Base URL: {environment.apiUrl} (typically /api, Base URL Configured with Nginx)
Authenticate user credentials and return JWT token.
{
"username": "string",
"password": "string"
}
{
"token": "string",
"username": "string"
}
401 Unauthorized
"Invalid credentials."
Verify JWT token and return user role information.
Authorization: Bearer {token}
{
"message": "Success",
"role": "string"
}
401 Unauthorized Token invalid or missing
Legacy single file upload endpoint (commented out in current implementation).
Authorization: Bearer {token}
• File: IFormFile
• UserId: string
{
"datasetId": "string",
"userId": "string",
"parquetPath": "string",
"totalRecords": 0,
"numColumns": 0,
"passRate": 0.0,
"dateRange": {
"start": "string",
"end": "string"
}
}
400 Bad Request "No file uploaded." or "User ID is required."
500 Internal Server Error Processing failure
Upload individual file chunk as part of chunked upload process.
Authorization: Bearer {token}
• file: IFormFile (chunk data)
• uploadId: string
• chunkIndex: string (numeric)
• userId: string
{}
500 Internal Server Error Chunk upload failed
Finalize chunked upload by reassembling chunks and processing the complete file.
Authorization: Bearer {token}
{
"uploadId": "string",
"fileName": "string",
"userId": "string",
"totalChunks": 0
}
{
"datasetId": "string",
"userId": "string",
"parquetPath": "string",
"totalRecords": 0,
"numColumns": 0,
"passRate": 0.0,
"dateRange": {
"start": "string",
"end": "string"
}
}
500 Internal Server Error File processing failure
Validate date ranges against stored dataset and return record counts.
Authorization: Bearer {token}
{
"userId": "string",
"datasetId": "string",
"dateRanges": {
"training": {
"start": "string",
"end": "string"
},
"testing": {
"start": "string",
"end": "string"
},
"simulation": {
"start": "string",
"end": "string"
}
}
}
{
"status": "Valid",
"training": {
"count": 0
},
"testing": {
"count": 0
},
"simulation": {
"count": 0
},
"monthlyCounts": {
"2023-01": 0,
"2023-02": 0
}
}
400 Bad Request Invalid date ranges
404 Not Found Dataset not found
500 Internal Server Error Validation failure
Train XGBoost model using specified date ranges and return performance metrics and plots.
Authorization: Bearer {token}
{
"userId": "string",
"datasetId": "string",
"dateRanges": {
"training": {
"start": "string",
"end": "string"
},
"testing": {
"start": "string",
"end": "string"
},
"simulation": {
"start": "string",
"end": "string"
}
}
}
{
"metrics": {
"accuracy": 0.0,
"precision": 0.0,
"recall": 0.0,
"f1Score": 0.0,
"truePositive": 0,
"falsePositive": 0,
"trueNegative": 0,
"falseNegative": 0
},
"plots": {
"featureImportance": "string",
"trainingPlot": "string"
}
}
400 Bad Request "UserId and DatasetId are required." or missing required date ranges
500 Internal Server Error Training service failure
WebSocket endpoint for real-time ML model simulation streaming. Proxies connections to FastAPI simulation service.
WebSocket (ws:// or wss://)
Start Simulation:
{
"action": "start",
"userId": "string",
"datasetId": "string"
}
Stop Simulation:
{
"action": "stop",
"userId": "string",
"datasetId": "string"
}
Simulation Result:
{
"rowIndex": 0,
"prediction": 0,
"confidence": 0.0,
"actual": 0,
"isCorrect": true,
"timestamp": "string"
}
Status Messages:
{"status": "stopped"}
{"status": "finished"}
{"status": "stopping"}
Error Messages:
{"error": "string"}
Base URL: http://localhost:8000 (Development) / http://ml_service:8000 (Production)
Receive and store individual file chunk in temporary directory.
• file: UploadFile (chunk data)
• uploadId: string (form field)
• chunkIndex: integer (form field)
• userId: string (form field)
{
"status": "chunk uploaded",
"chunkIndex": 0
}
500 Internal Server Error "Could not save chunk {chunkIndex}."
Reassemble uploaded chunks into complete file and process it to Parquet format.
{
"uploadId": "string",
"fileName": "string",
"userId": "string",
"totalChunks": 0
}
{
"datasetId": "string",
"userId": "string",
"parquetPath": "string",
"totalRecords": 0,
"numColumns": 0,
"passRate": 0.0,
"dateRange": {
"start": "string",
"end": "string"
}
}
400 Bad Request "Upload failed: Missing chunk {i}."
404 Not Found "Upload ID not found."
500 Internal Server Error "An internal error occurred during file processing."
Validate date ranges against stored dataset and return record counts for training, testing, and simulation periods.
{
"userId": "string",
"datasetId": "string",
"dateRanges": {
"training": {
"start": "string",
"end": "string"
},
"testing": {
"start": "string",
"end": "string"
},
"simulation": {
"start": "string",
"end": "string"
}
}
}
{
"status": "Valid",
"training": {
"count": 0
},
"testing": {
"count": 0
},
"simulation": {
"count": 0
},
"monthlyCounts": {
"2023-01": 0,
"2023-02": 0
}
}
400 Bad Request
{
"status": "Invalid",
"detail": "string"
}
404 Not Found Dataset not found (ValueError)
500 Internal Server Error "An internal server error occurred."
Train XGBoost model using specified date ranges and return detailed performance metrics and visualization plots.
{
"userId": "string",
"datasetId": "string",
"dateRanges": {
"training": {
"start": "string",
"end": "string"
},
"testing": {
"start": "string",
"end": "string"
},
"simulation": {
"start": "string",
"end": "string"
}
}
}
{
"metrics": {
"accuracy": 0.0,
"precision": 0.0,
"recall": 0.0,
"f1Score": 0.0,
"trueNegative": 0,
"falsePositive": 0,
"falseNegative": 0,
"truePositive": 0
},
"plots": {
"featureImportance": "string",
"trainingPlot": "string"
}
}
400 Bad Request "Request must include 'training', 'testing', and 'simulation' date ranges." or ValueError from service
500 Internal Server Error "An internal server error occurred: {error}"
Real-time streaming WebSocket endpoint for ML model simulation results.
WebSocket (ws://)
Start Simulation:
{
"action": "start",
"userId": "string",
"datasetId": "string"
}
Stop Simulation:
{
"action": "stop",
"userId": "string",
"datasetId": "string"
}
Simulation Result (streaming):
{
"rowIndex": 0,
"prediction": 0,
"confidence": 0.0,
"actual": 0,
"isCorrect": true,
"timestamp": "string"
}
Status Messages:
{"status": "stopped"}
{"status": "finished"}
{"status": "stopping"}
Error Messages:
{"error": "userId and datasetId are required."}
{"error": "An unexpected error occurred during simulation: {error}"}